home *** CD-ROM | disk | FTP | other *** search
/ Mac Cube 4: Multimedia Applications / MacCube Volume 4: Multimedia Applications.iso / Graphics / POV Ray / POVSOURCE / SOURCE / Config.h < prev    next >
Text File  |  1994-02-04  |  10KB  |  259 lines

  1. /*==============================================================================
  2. Project:    POV-Ray
  3.  
  4. Version:    2.2
  5.  
  6. File:    Config.h -- Macintosh
  7.  
  8. Description:
  9.     This file contains Macintosh-specific defines, types, etc for both the
  10.     Think C 5.0 and MPW 3.2 development environments.
  11. ------------------------------------------------------------------------------
  12. Authors:
  13.     Thomas Okken, David Lichtman, Glenn Sugden
  14.     Jim Nitchals, Eduard [esp] Schwan
  15. ------------------------------------------------------------------------------
  16.     from Persistence of Vision Raytracer
  17.     Copyright 1993 Persistence of Vision Team
  18. ------------------------------------------------------------------------------
  19.     NOTICE: This source code file is provided so that users may experiment
  20.     with enhancements to POV-Ray and to port the software to platforms other 
  21.     than those supported by the POV-Ray Team.  There are strict rules under
  22.     which you are permitted to use this file.  The rules are in the file
  23.     named POVLEGAL.DOC which should be distributed with this file. If 
  24.     POVLEGAL.DOC is not available or for more info please contact the POV-Ray
  25.     Team Coordinator by leaving a message in CompuServe's Graphics Developer's
  26.     Forum.  The latest version of POV-Ray may be found there as well.
  27.  
  28.     This program is based on the popular DKB raytracer version 2.12.
  29.     DKBTrace was originally written by David K. Buck.
  30.     DKBTrace Ver 2.0-2.12 were written by David K. Buck & Aaron A. Collins.
  31. ------------------------------------------------------------------------------
  32. More Info:
  33.     This Macintosh version of POV-Ray was created and compiled by Jim Nitchals
  34.     (Think 5.0) and Eduard Schwan (MPW 3.2), based (loosely) on the original
  35.     port by Thomas Okken and David Lichtman, with some help from Glenn Sugden.
  36.  
  37.     For bug reports regarding the Macintosh version, you should contact:
  38.     Eduard [esp] Schwan
  39.         CompuServe: 71513,2161
  40.         Internet: jl.tech@applelink.apple.com
  41.         AppleLink: jl.tech
  42.     Jim Nitchals
  43.         Compuserve: 73117,3020
  44.         America Online: JIMN8
  45.         Internet: jimn8@aol.com -or- jimn8@applelink.apple.com
  46.         AppleLink: JIMN8
  47. ------------------------------------------------------------------------------
  48. Change History:
  49.     920815    [jln]    version 1.0 Mac released.
  50.     921105    [esp]    version 1.1 beta Mac
  51.     930902    [esp]    version 1.9 beta Mac
  52.     931001    [esp]    version 2.0 finished (Released on 10/4/93)
  53.     931119    [djh]    2.0.1 source conditionally compiles for PPC machines, keyword __powerc
  54. ==============================================================================*/
  55.  
  56. #if !defined(CONFIG_H)
  57. #define CONFIG_H
  58.  
  59. #include <stdarg.h>
  60. #include <stdlib.h>
  61.  
  62. #if defined(__powerc)
  63. #include <fp.h>                /* superset of math.h */
  64. #else
  65. #include <math.h>            /* fmod, floor, HUGE_VAL! */
  66. #endif
  67.  
  68. #include "POVLib.h"
  69.  
  70. /* Below are several defines needed by the generic parts of POV.  You
  71. *   may redefine them as needed in this config.h file.
  72. *
  73. *   The following constants are needed by various POV modules.  Each has
  74. *   a default (shown below) which is will be defined in frame.h if you don't 
  75. *   define them here.
  76. *
  77. *   #define EPSILON 1.0e-10               - a small value used for POLY
  78. *   #define FILE_NAME_LENGTH 150          - default file name length
  79. *   #define HUGE_VAL 1.0e+17              - a really big number
  80. *   #define DBL_FORMAT_STRING "%lf"       - the string to use for scanfs of doubles
  81. *   #define DEFAULT_OUTPUT_FORMAT  'd'    - the default +f format
  82. *   #define RED_RAW_FILE_EXTENSION ".red" - for +fr, this is the extension for the
  83. *                                           red file
  84. *   #define GREEN_RAW_FILE_EXTENSION ".grn"  - ditto for the green file
  85. *   #define BLUE_RAW_FILE_EXTENSION ".blu"   - ditto again for the blue file
  86. *   #define FILENAME_SEPARATOR "/"        - the character that separates names
  87. *                                           in a path.
  88. *   #define CASE_SENSITIVE_DEFAULT 2     - controls case sensitivity in DAT files
  89. *   #define READ_FILE_STRING "rb"        - special binary (raw, uncooked) 
  90. *   #define WRITE_FILE_STRING "wb"         modes of fopen()
  91. *   #define APPEND_FILE_STRING "ab"
  92. *   #define NORMAL '0'                   - machine-specific PaletteOption settings 
  93. *   #define GREY   'G'
  94. *
  95. *   These routines are required by POV to compute trace times.  The defaults 
  96. *   shown below are defined in most versions of C.  You may redefine them if
  97. *   your compiler doesn't support these.  If time is completely unsupported 
  98. *   define them as 0.
  99. *
  100. *   #define START_TIME time(&tstart);     
  101. *   #define STOP_TIME  time(&tstop);
  102. *   #define TIME_ELAPSED difftime (tstop, tstart);
  103. *
  104. *   Note difftime can be replaced with: #define TIME_ELAPSED (tstop - tstart); 
  105. *   in some cases. 
  106. *
  107. *   These are optional routines that POV calls.  You may define them
  108. *   or if undefined they will be defined as empty in frame.h.
  109. *
  110. *   #define STARTUP_POVRAY             - first executable statement of main
  111. *                                           (useful for initialization)
  112. *   #define PRINT_OTHER_CREDITS           - used for people who extend the machine specific modules
  113. *                                           (put your own printf's here)
  114. *   #define TEST_ABORT                    - code to test for ^C or abort
  115. *                                           (called on each pixel)
  116. *   #define FINISH_POVRAY              - last statement before exiting normally
  117. *   #define COOPERATE                    - called for multi-tasking
  118. *  
  119. *   These items are standard on some C compilers.  If they are not defined
  120. *   on your compiler or are called something different you may define your 
  121. *   own or use the defaults supplied in frame.h as shown below.
  122. *
  123. *   #define DBL double                    - floating point precision
  124. *   #define ACOS acos                     - arc cosine of DBL
  125. *   #define SQRT sqrt                     - square root of DBL
  126. *   #define POW pow                       - x to the y power - x, y DBL
  127. *   #define COS cos                       - cosine of DBL
  128. *   #define SIN sin                       - sine of DBL
  129. *   #define labs(x) (long) ((x<0)?-x:x)   - Returns the absolute value of long integer x
  130. *   #define max (x,y) ((x<y)?y:x)         - greater of x and y
  131. *
  132. *   On some systems "sprintf" returns the string rather than the length
  133. *   of the string.  If the string is returned, define the following:
  134. *   #define STRLN(x) strlen(x)
  135. *
  136. *   #define setvbuf(w,x,y,z)              - some systems don't understand setvbuf.
  137. *                                           If not, just define it away - it's
  138. *                                           not critical to the raytracer.  It
  139. *                                           just buffers disk accesses.
  140. *   This macro controls prototyping and is required by POV.  Choose one
  141. *   of the two options below or if left undefined it will default to ANSI 
  142. *   in frame.h
  143. *
  144. *   #define PARAMS (x) x                  - do ANSI prototyping
  145. *   #define PARAMS (x) ()                 - do K&R non-ANSI prototyping
  146. *
  147. *   These allow command line vs non-command line versions and alternate
  148. *   main routines.  Normally they should be undefined.  Define them 1 if needed.
  149. *   #define ALTMAIN 1
  150. *   #define NOCMDLINE 1
  151. ****************************************************/
  152.  
  153. /*==== FRAME.H Overrides ====*/
  154.  
  155. //        Identifier            Mac Value    .. Default Value
  156. //        ----------            ---------    -- -------------
  157. #define FILE_NAME_LENGTH    255            //    150
  158. #define    FILENAME_SEPARATOR    ":"            //    "/"
  159. #define EPSILON                1.0e-10        //    1.0e-10
  160. #if !defined(HUGE_VAL)
  161. #define HUGE_VAL            1.0e+20        //    1.0e+17
  162. #endif // !HUGE_VAL
  163. #define BOUND_HUGE            1.0e30        //    1.0e30
  164. #define MAX_CONSTANTS        1000        //    1000
  165. #define ALTMAIN                1            //    0 (on makes main() a subroutine)
  166. #define MAIN_RETURN_TYPE    int            //    main() return type
  167.  
  168. // turn on/off USE_LONG_DBL to use long float or regular float
  169. // NOTE: MPW C compiler treats long double as extended, the native type,
  170. // so supposedly there would be less converting happening.
  171.  
  172. #if !defined (__powerc)
  173. #define USE_LONG_DBL    1
  174. #endif
  175.  
  176. #if defined(USE_LONG_DBL)
  177. #define DBL long double
  178. #define DBL_FORMAT_STRING "%Lf"
  179. #else
  180. #define DBL double
  181. #define DBL_FORMAT_STRING "%lf"
  182. #endif // USE_LONG_DBL
  183.  
  184. #if defined (applec)
  185. #define COMPILER_VER    ".MACMPW"
  186. #endif // applec
  187.  
  188. #if defined (THINK_C)
  189. #define COMPILER_VER    ".MACTHC"
  190. #endif // THINK_C
  191.  
  192. #if defined (gcc)
  193. #define COMPILER_VER    ".MACGNU"
  194. #endif // gcc
  195.  
  196. #if !defined(COMPILER_VER)
  197. #define COMPILER_VER    ".MAC???"
  198. #endif // COMPILER_VER
  199.  
  200.  
  201. #define START_TIME        {tused = 0; tstart = TICKS;}
  202. #define STOP_TIME        tstop = TICKS; 
  203. #define TIME_ELAPSED    ((tstop - tstart) / 60L);
  204.  
  205. #define TEST_ABORT        Cooperate(false);    // if (Stop_Flag) return;
  206.  
  207. #define STARTUP_POVRAY    int Display_Started = false; int Shadow_Test_Flag = false;
  208.  
  209. #define COOPERATE        Cooperate(false);
  210.  
  211. #define PRINT_CREDITS        // called in Pov.c
  212. #define PRINT_OTHER_CREDITS    // called in Pov.c
  213.  
  214. // Just use stock print_stats routine
  215. // #define PRINT_STATS                    // routine to display stats
  216.  
  217. // we don't do anything special on completion
  218. #define FINISH_POVRAY                    // called before exiting engine
  219.  
  220.  
  221. /*==== Other Mac support ====*/
  222. /*
  223. The rest of this file is Mac-specific, and has nothing
  224. to do with the generic POV-Ray code.
  225. */
  226.  
  227. /* capture any c library calls & do the Mac thing instead */
  228. #define    exit(n)                catch_exit(n)
  229.  
  230.  
  231. #if defined (THINK_C)
  232. #define TICKS                Ticks
  233. // typedef int (*__cmp_func)(const void *, const void *);
  234. #define QSORT_FUNCT_RET        int
  235. #define QSORT_FUNCT_PARAM    void *
  236. #endif
  237.  
  238. #if defined (applec)
  239. #include <sysequ.h>        // for Ticks
  240. #define TICKS                (*(long*)Ticks)
  241. #define QSORT_FUNCT_RET        int
  242. #define QSORT_FUNCT_PARAM    void *
  243. #endif // applec
  244.  
  245. #if defined (__powerc)
  246. #include <sysequ.h>        // for Ticks
  247. #define TICKS                (volatile *(long*)Ticks)
  248. #define QSORT_FUNCT_RET        int
  249. #define QSORT_FUNCT_PARAM    void *
  250. #endif // applec
  251.  
  252. /* Mac-specific routines that must now be defined */
  253.  
  254. void    catch_exit(int n);
  255. void    Cooperate(int doImmediate);
  256.  
  257.  
  258. #endif /* CONFIG_H */
  259.